package com.atguigu.stgy.app.controller;

//import com.atguigu.stgy.admin.service.LeaseAgreementService;
import com.atguigu.stgy.app.service.LeaseAgreementService;
import com.atguigu.stgy.model.dto.AgreementSearchDTO;
import com.atguigu.stgy.model.entity.LeaseAgreement;
import com.atguigu.stgy.model.result.R;
import com.atguigu.stgy.model.vo.AgreementDetailVo;
import com.atguigu.stgy.model.vo.AgreementItemVo;
import com.atguigu.stgy.model.vo.AgreementVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 租约信息表(lease_agreement)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/app/agreement")
public class LeaseAgreementController {
    /**
     * 服务对象
     */
    @Resource
    private LeaseAgreementService leaseAgreementService;
    ///app/agreement/getDetailById
    @Operation(summary = "查询租约详情")
    @GetMapping("getDetailById")
    public R getDetailById(@RequestParam Long id){
//        Page<AgreementVO> page = leaseAgreementService.pageItem(searchDTO);
        AgreementDetailVo agreementDetailVo =  leaseAgreementService.getDetailById(id);
        return R.ok(agreementDetailVo);
    }
    ///app/agreement/listItem
    @Operation(summary = "查询用户的租约列表")
    @GetMapping("listItem")
    public R listItem(){
//        Page<AgreementVO> page = leaseAgreementService.pageItem(searchDTO);
        List<AgreementItemVo> agreementItemVos =  leaseAgreementService.listItem();
        return R.ok(agreementItemVos);
    }


}
